package serviceTest;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import service.EquipmentService;
import service.ICompanyService;
import common.BasePersistenceTest;
import entity.Company;
import entity.Equipment;
import entity.Staff;

public class CompanyServiceTest extends BasePersistenceTest {

	@Autowired
	private ICompanyService companyService;

	@Test
	public void testGetAllEquipments() {
		Company com = new Company("ct");

		Staff staff1 = new Staff(com);

		Equipment eq1 = new Equipment("eq1", com);
		Equipment eq2 = new Equipment("eq2", com);
		
		getPersistenceManager().save(com);

		EquipmentService equipmentService = new EquipmentService();

		equipmentService.borrow(staff1, eq1);

		assertEquals(2, companyService.getAllEquipments().size());
	}

}
